home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\INCLUDE\IRC_STD.H < prev    next >
C/C++ Source or Header  |  1995-01-04  |  4KB  |  168 lines

  1. /*
  2.  * irc_std.h: header to define things used in all the programs ircii
  3.  * comes with
  4.  *
  5.  * hacked together from various other files by matthew green
  6.  * copyright(c) 1993 
  7.  *
  8.  * See the copyright file, or do a help ircii copyright 
  9.  *
  10.  * @(#)$Id: irc_std.h,v 1.12 1994/10/15 23:10:12 mrg Stab $
  11.  */
  12.  
  13. #ifndef __irc_std_h
  14. #define __irc_std_h
  15.  
  16. #undef __P
  17. #if defined(__STDC__) || defined(__BORLANDC__)
  18. # define __P(a) a
  19. #else
  20. # define __P(a) ()
  21. # define const
  22. #endif
  23.  
  24. #ifdef _IBMR2
  25. # include <sys/errno.h>
  26. # include <sys/select.h>
  27. #else
  28. # include <errno.h>
  29. extern    int    errno;
  30. #endif /* _IBMR2 */
  31.  
  32. #ifdef TRUE
  33. # define TRUE 1
  34. #endif /* TRUE */
  35.  
  36. #ifndef FALSE
  37. # define FALSE !TRUE
  38. #endif /* FALSE */
  39.  
  40. #ifndef NBBY
  41. # define NBBY    8        /* number of bits in a byte */
  42. #endif /* NBBY */
  43.  
  44. #ifndef NFDBITS
  45. # define NFDBITS    (sizeof(long) * NBBY)    /* bits per mask */
  46. #endif /* NFDBITS */
  47.  
  48. #ifndef FD_SET
  49. # define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  50. #endif /* FD_SET */
  51.  
  52. #ifndef FD_CLR
  53. # define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  54. #endif /* FD_CLR */
  55.  
  56. #ifndef FD_ISSET
  57. # define FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  58. #endif /* FD_ISSET */
  59.  
  60. #ifndef FD_ZERO
  61. # define FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  62. #endif /* FD_ZERO */
  63.  
  64. #ifndef    FD_SETSIZE
  65. # define FD_SETSIZE    32
  66. #endif
  67.  
  68. #ifdef USE_SIGACTION
  69.  
  70. typedef RETSIGTYPE sigfunc __P((int));
  71. sigfunc *my_signal __P((int, sigfunc *, int));
  72.  
  73. # define MY_SIGNAL(s_n, s_h, m_f) my_signal(s_n, s_h, m_f)
  74. #else
  75. # if USE_SIGSET
  76. #  define MY_SIGNAL(s_n, s_h, m_f) sigset(s_n, s_h)
  77. # else
  78. #  define MY_SIGNAL(s_n, s_h, m_f) signal(s_n, s_h)
  79. # endif /* USE_SIGSET */
  80. #endif /* USE_SIGACTION */
  81.  
  82. #if defined(USE_SIGACTION) || defined(USE_SIGSET)
  83. # undef SYSVSIGNALS
  84. #endif
  85.  
  86. #if defined(__svr4__) && !defined(SVR4)
  87. # define SVR4
  88. #else
  89. # if defined(SVR4) && !defined(__svr4__)
  90. #  define __svr4__
  91. # endif
  92. #endif
  93.  
  94. #ifdef _SEQUENT_
  95. # define    u_short    ushort
  96. # define    u_char    unchar
  97. # define    u_long    ulong
  98. # define    u_int    uint
  99. # define    USE_TERMIO
  100. # ifndef POSIX
  101. #  define POSIX
  102. # endif
  103. #endif /* _SEQUENT_ */
  104.  
  105. #ifdef STDC_HEADERS
  106. # include <stdlib.h>
  107. #endif
  108.  
  109. #ifndef NeXT
  110. # if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  111. #  include <string.h>
  112. #  if defined(HAVE_MEMORY_H)
  113. #   include <memory.h>
  114. #  endif /* HAVE_MEMORY_H */
  115. #  undef index
  116. #  undef rindex
  117. #  undef bcopy
  118. #  undef bzero
  119. #  undef bcmp
  120. #  define index strchr
  121. #  define rindex strrchr
  122. #  ifdef HAVE_MEMMOVE
  123. #   define bcopy(s, d, n) memmove((d), (s), (n))
  124. #  else
  125. #   define bcopy(s, d, n) memcpy ((d), (s), (n))
  126. #  endif
  127. #  define bcmp(s, t, n) memcmp ((s), (t), (n))
  128. #  define bzero(s, n) memset ((s), 0, (n))
  129. # else /* STDC_HEADERS || HAVE_STRING_H */
  130. #  include <strings.h>
  131. # endif /* STDC_HEADERS || HAVE_STRING_H */
  132. #endif /* !NeXT */
  133.  
  134. #ifndef SYS_ERRLIST_DECLARED
  135. extern    char    *sys_errlist[];
  136. extern    int    sys_nerr;
  137. #endif
  138.  
  139. #ifdef _Window
  140. extern char far * far winsock_errors[];
  141. # define strerror(e) ((e) >= 0 && (e) < sys_nerr ? sys_errlist[e] : ((e) >=WSABASEERR ? winsock_errors[(e) - WSABASEERR] : "(unknown)"))
  142. #else
  143. #ifdef NEED_STRERROR
  144. # undef strerror
  145. # define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
  146. #endif /* NEED_STRERROR */
  147. #endif /*_Windows */
  148.  
  149. /* we need an unsigned 32 bit integer for dcc, how lame */
  150.  
  151. #ifdef UNSIGNED_LONG32
  152.  
  153. typedef        unsigned long        u_32int_t;
  154.  
  155. #else
  156. # ifdef UNSIGNED_INT32
  157.  
  158. typedef        unsigned int        u_32int_t;
  159.  
  160. # else
  161.  
  162. typedef        unsigned long        u_32int_t;
  163.  
  164. # endif /* UNSIGNED_INT32 */
  165. #endif /* UNSIGNED_LONG32 */
  166.  
  167. #endif /* __irc_std_h */
  168.